package com.xundao.yxt.common.vo.base;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
@AllArgsConstructor
public class PageResultVo<T>  implements Serializable {
    private static final long serialVersionUID = 1L;
    private List<T> dataList;
    private Long total;
    private Integer pageNum;
    private Integer pageSize;
    private Integer totalPage;

    public PageResultVo(List<T> dataList, Long total) {
        this.dataList =dataList;
        if (total == null) {
            total = 0L;
        }
        this.total = total;
        this.pageNum = 1;
        this.pageSize = 10;
        this.totalPage = (int) Math.ceil((double) total / pageSize);
    }
}
